package server

import "time"

type ClientReadIdleTimeout struct {
	client *Client
}

func (x *ClientReadIdleTimeout) OnTimeout() {
	x.client.onReadIdleTimeout()
}

func (x *ClientReadIdleTimeout) IsTimeout() bool {
	return x.client.lastReadAt.Add(x.client.readIdleTimeout).Before(time.Now())
}

func NewClientReadIdleTimeout(client *Client) *ClientReadIdleTimeout {
	return &ClientReadIdleTimeout{client: client}
}
